<script setup lang="ts">
import { computed, ref } from 'vue';
import { $t } from '@/locales';
import { noticelist } from '@/service/api';
import { getTableData } from '@/service/api/modules/collection-management/equipment-alarm-info';
defineOptions({
  name: 'ProjectNews'
});

interface NewsItem {
  id: number;
  content: string;
  time: string;
}

// const newses = computed<NewsItem[]>(() => []);

const tableData = ref<any[]>([]);
function getTableDatas() {
  noticelist().then(({ error, data }) => {
    if (!error) {
      console.log(data.rows);
      tableData.value = data.rows;
    }
  });
}
const columns = [
  {
    key: 'noticeTitle',
    dataIndex: 'noticeTitle',
    title: '标题',
    width: 160,
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    key: 'noticeContent',
    dataIndex: 'noticeContent',
    title: '公告详情',
    align: 'center',
    checked: true,
    ellipsis: true
  },
  {
    width: 120,
    key: 'createBy',
    dataIndex: 'createBy',
    title: '发布人',
    align: 'center',
    checked: true,
    ellipsis: true
  }
];
getTableDatas();
</script>

<template>
  <ACard title="系统公告" :bordered="false" size="small" class="h-full w-full card-wrapper">
    <!--
 <template #extra>
      <a class="text-primary" href="javascript:;">{{ $t('page.home.projectNews.moreNews') }}</a>
    </template>
-->
    <!--
 <AList :data-source="newses">
      <template #renderItem="{ item }">
        <AListItem>
          <AListItemMeta :title="item.content" :description="item.time">
            <template #avatar>
              <SoybeanAvatar class="size-48px!" />
            </template>
          </AListItemMeta>
        </AListItem>
      </template>
    </AList>
-->
    <ATable
      :data-source="tableData"
      :columns="columns"
      bordered
      class="h-full"
      :pagination="false"
      :scroll="{ y: 'auto' }"
    ></ATable>
  </ACard>
</template>

<style scoped></style>
